﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OrderingPlatform.Infrastructure;

namespace OrderingPlatform.DalService.CategoryManage
{
   public class DictConfigDal
    {
       public List<KeyValuePair<string, string>> GetDict(string category,string name)
       {
           using (var db = new OrderingPlatformDbEntities())
           {
               var list = (from p in db.DictConfigs
                           where string.IsNullOrEmpty(category) || p.Category == category
                           where string.IsNullOrEmpty(name)||p.DictName==name
                           select p).ToList().Select(p => new KeyValuePair<string, string>(p.DictName, p.DictValue));
               return list.ToList();
           }
       }
    }
}
